j3deditor.bin.util
Class ImageLoader

java.lang.Object
  extended by j3deditor.bin.util.ImageLoader

public class ImageLoader
extends java.lang.Object

Tool for loading images.

Author:
Risto Seene

Field Summary
static java.lang.String imagePath
          path of the images inside the JAR file.
 
Constructor Summary
ImageLoader()
          Creates an instance of ImageLoader.
 
Method Summary
 java.awt.Image getImage(java.io.File source)
          Loads an image from disk and returns it as an instance of Image.
 java.awt.Image getImage(java.lang.String path)
          Loads an image from JAR file and returns it as an instance of Image.
 javax.swing.ImageIcon getImageIcon(java.io.File source)
          Loads an image from disk and returns it as an instance of ImageIcon.
 javax.swing.ImageIcon getImageIcon(java.lang.String path)
          Loads an image from JAR file and returns it as an instance of ImageIcon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imagePath

public static final java.lang.String imagePath
path of the images inside the JAR file.

See Also:
Constant Field Values
Constructor Detail

ImageLoader

public ImageLoader()
Creates an instance of ImageLoader.

Method Detail

getImage

public java.awt.Image getImage(java.lang.String path)
Loads an image from JAR file and returns it as an instance of Image.

Parameters:
path - the path of an image file relative to "/j3deditor/images"
Returns:
If file exists returns the image as an instance of Image, otherwise returns null

getImage

public java.awt.Image getImage(java.io.File source)
Loads an image from disk and returns it as an instance of Image.

Parameters:
source - image file
Returns:
If file exists returns the image as an instance of Image, otherwise returns null

getImageIcon

public javax.swing.ImageIcon getImageIcon(java.lang.String path)
Loads an image from JAR file and returns it as an instance of ImageIcon.

Parameters:
path - the path of an image file relative to "/j3deditor/images"
Returns:
If file exists returns the image as an instance of ImageIcon, otherwise returns null

getImageIcon

public javax.swing.ImageIcon getImageIcon(java.io.File source)
Loads an image from disk and returns it as an instance of ImageIcon.

Parameters:
source - image file
Returns:
If file exists returns the image as an instance of ImageIcon, otherwise returns null